package top.kaoshanji.p1ch02c;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import java.lang.invoke.MethodType;

/**
 * 代码清单 p1ch02c-03：MethodType#fromMethodDescriptorString的使用示例
 * author kaoshanji
 * ^_^
 * create time 2025/1/2 16:46
 */
public class MethodTypeExample03 {

    private static final Logger logger = LogManager.getLogger(MethodTypeExample03.class);

    public static void main(String[] args) {

        new MethodTypeExample03().fromMethodDescriptorString();

    }

    public void fromMethodDescriptorString() {
        logger.info("...代码清单 p1ch02c-03：MethodType#fromMethodDescriptorString的使用示例...");

        ClassLoader cl = this.getClass().getClassLoader();
        String descriptor = "(Ljava/lang/String;)Ljava/lang/String;";
        MethodType mt1 = MethodType.fromMethodDescriptorString(descriptor, cl);

        System.out.println(mt1);

    }

}
